package b_state.b_design_patten;

/**
 * Created by wug on 2016/6/14 0014.
 */
public class StateSoldOut implements State {
    WaterMachine waterMachine;

    public StateSoldOut(WaterMachine waterMachine) {
        this.waterMachine = waterMachine;
    }

    @Override
    public void workerPut() {
        waterMachine.setNum(10);
        System.out.println("工人往里放了" + waterMachine.getNum() +"瓶水!");
    }

    @Override
    public void insertMoney(int num) {
        waterMachine.setState(new StateNoMoney(waterMachine));
        waterMachine.insert(num);
    }

    @Override
    public void pressSellBtn() {
//        waterMachine.setState(new StateLucky(waterMachine));
        waterMachine.setState(new StateSold(waterMachine));
        waterMachine.sell();
    }

    @Override
    public void refundRocker() {
        waterMachine.setState(new StateHaveMoney(waterMachine));
        waterMachine.retun();
    }
}
